﻿using GreenXi.ViewModel;
using LiveCharts;
using System.Windows.Controls;
using System.Windows.Input;

namespace GreenXi.Pages.Chart
{
    /// <summary>
    /// LocationData.xaml 的交互逻辑
    /// </summary>
    public partial class LocationData : UserControl
    {
        public SeriesCollection SeriesCollection { get; set; }
        public SeriesCollection PolylinSeries { get; set; }
        public LocationData()
        {
            InitializeComponent();
            DataContext = new CustomerVm();
        }







        private void UIElement_OnMouseMove(object sender, MouseEventArgs e)
        {

            //var vm = (CustomerVm)DataContext;
            //var chart = (LiveCharts.Wpf.CartesianChart)sender;
            //var mouseCoordinate = e.GetPosition(chart);

            //var p = chart.ConvertToChartValues(mouseCoordinate);
            //if (p != new Point(0, 0))
            //{

            //    vm.YPointer = p.Y;

            //    if (chart.Series != null)
            //    {
            //        var series = chart.Series[0];
            //        var x = p.X;
            //        var x2 = AxisOrientation.X;

            //        ChartPoint result = null;
            //        double num = double.PositiveInfinity;
            //        var abc = series.ActualValues.Count;
            //        if (abc > 0)
            //        {
            //            foreach (ChartPoint point in series.Values.GetPoints(series))
            //            {
            //                double num2 = ((x2 == AxisOrientation.X) ? point.X : point.Y);
            //                double num3 = Math.Abs(num2 - x);
            //                if (num3 < num)
            //                {
            //                    result = point;
            //                    num = num3;
            //                }
            //            }
            //            vm.XPointer = result.X;
            //        }
            //        else
            //        {
            //            vm.XPointer = 2;
            //        }
            //    }





            //}



        }


    }
}
